#ifndef CRECTANDPOS_H
#define CRECTANDPOS_H

#include <QDialog>
class QPushButton;
class QLabel;
class QLineEdit;
class QHBoxLayout;
class QVBoxLayout;

#define CRectAndPosIns CRectAndPos::Instance()

class CRectAndPos : public QDialog
{
    Q_OBJECT
public:
    CRectAndPos();

    static CRectAndPos *Instance();

public:
    void SetCurrentData(const QRectF &rect);
    void ChangeCurrentData(QRectF &rect);
    void SetCurrentData2(qreal width,qreal height);
    void ChangeCurrentData2(qreal &width,qreal &height);

protected:
    void showEvent(QShowEvent *event) override;

private:
    void initDialog();

private:
    QPushButton *btn_ok{nullptr};
    QPushButton *btn_cancle{nullptr};
    QLabel *label_width{nullptr};
    QLabel *label_height{nullptr};
    QLabel *label_pos_x{nullptr};
    QLabel *label_pos_y{nullptr};
    QLineEdit *lineedit_width{nullptr};
    QLineEdit *lineedit_height{nullptr};
    QLineEdit *lineedit_pos_x{nullptr};
    QLineEdit *lineedit_pos_y{nullptr};
    QHBoxLayout *h_layout_width{nullptr};
    QHBoxLayout *h_layout_height{nullptr};
    QHBoxLayout *h_layout_pos_x{nullptr};
    QHBoxLayout *h_layout_pos_y{nullptr};
    QHBoxLayout *h_layout_btn{nullptr};
    QVBoxLayout *v_layout{nullptr};
};

#endif // CRECTANDPOS_H
